package com.github.wj.web.service.impl;

import com.github.wj.common.security.util.DateFormatUtils;
import com.github.wj.orm.security.datasource.DBUtil;
import com.github.wj.web.entity.TjxZyGxjx01;
import com.github.wj.web.service.CustomZyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.util.Date;
import java.util.List;

/**
 * Create by IntelliJ IDEA
 * 用户：王建
 * 日期：2018/3/18
 */
@Service
public class CustomZyServiceImpl implements CustomZyService {

    @Autowired
    private DBUtil dbUtil;
    @Override
    public List<TjxZyGxjx01> getAllByOgrid(Long orgid) {
        String sql="select id,zymc from tjx_zy_gxjx01 where zzjg = ? and zymc like ? ";
        String date="";
        try {
            date= DateFormatUtils.formatDate(new Date(),"yyyy/MM/dd");
            date=date.substring(2,4);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return dbUtil.getAllBeanList(sql,TjxZyGxjx01.class,orgid,date+"%");
    }
}
